package com.dwcode.macro.dto;


import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;

import java.util.ArrayList;
import java.util.List;

@ApiModel("分页信息")
public class Pagination<T> {

    // 当前页,默认第一页
    @ApiModelProperty("当前页")
    private int pageNum = 1;
    // 每页显示条数，默认每页显示10条
    @ApiModelProperty("每页条数")
    private int pageSize = 10;
    // 总条数
    @ApiModelProperty("总条数")
    private int total;
    // 存放列表属性
    @ApiModelProperty("分页显示的数据")
    private List<T> rows = new ArrayList<T>();


    public Pagination() {
    }

    public Pagination(int total, List<T> rows) {
        this.total = total;
        this.rows = rows;
    }

    public int getPageNum() {
        return pageNum;
    }

    public void setPageNum(int pageNum) {
        this.pageNum = pageNum;
    }

    public int getPageSize() {
        return pageSize;
    }

    public void setPageSize(int pageSize) {
        this.pageSize = pageSize;
    }

    public int getTotal() {
        return total;
    }

    public void setTotal(int total) {
        this.total = total;
    }

    public List<T> getRows() {
        return rows;
    }

    public void setRows(List<T> rows) {
        this.rows = rows;
    }

    @Override
    public String toString() {
        return "Pagination{" +
                "pageNum=" + pageNum +
                ", pageSize=" + pageSize +
                ", total=" + total +
                ", rows=" + rows +
                '}';
    }
}
